import Vue from 'vue'
import VueRouter from 'vue-router'
// import Login from '../views/Login'
import Layout from '../views/Layout'
import Home from '../views/Home'
import User from '../views/User'
import Search from '../views/Search'
import ResultList from '../views/Search/ResultList.vue'
import ArticleDetail from '../views/Article/id.vue'
import UserEditor from '../views/User/userEdit.vue'
import Chat from '../views/Chat'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    // component: Login
    component: () => import('@/views/Login')
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'user',
        component: User
      }
    ]
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/search/:kw',
    component: ResultList
  },
  {
    path: '/article',
    component: ArticleDetail
  },
  {
    path: '/user_editor',
    component: UserEditor
  },
  {
    path: '/chat',
    component: Chat
  }
]

const router = new VueRouter({
  routes
})

export default router
